import java.util.Scanner;

/**
 * 用户服务
 *
 * @author yuwei
 * @date 19:56 2024/4/24
 */
public class attendanceManage {

    public static void add()
    {
        System.out.println("--添加考情--");
        System.out.println("输入主题");
        Scanner scan = new Scanner(System.in);
        if (attendanceTable.attendances.add(new Attendance(scan.next())))
        {
            System.out.println("添加成功");
        }
        else
        {
            System.out.println("添加失败,考勤已经存在");
        }
    }


    public static void show() {
        if(attendanceTable.attendances.size()==0){
            System.out.println("    无任何数据 ");
            return;
        }
        attendanceTable.attendances.forEach(System.out::println);
    }
    public static void delete(){
        System.out.println("--删除考勤--");
        if(attendanceTable.attendances.size()==0){
            System.out.println("    无任何数据 ");
            return;
        }
        for(int i = 1;i<=attendanceTable.attendances.size();i++){
            System.out.println(i+"."+attendanceTable.attendances.toArray()[i-1]);
            if(i==attendanceTable.attendances.size()){
                System.out.println("输入要删除的删除编号");
                Scanner scan = new Scanner(System.in);
                int index = scan.nextInt();
                if(index<=attendanceTable.attendances.size()&&index>0){

                    attendanceTable.attendances.remove(attendanceTable.attendances.toArray()[index-1]);
                    System.out.println("删除成功");
                }
                else{
                    System.out.println("输入错误");
                }
            }
        }
    }
}
